Add support for multiple cameras in multiple robots - #82
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
The generic launch file still pushes camera_name even though the component now also sets namespace=LaunchConfiguration('camera_name'). Launching ob_camera.launch.py with the defaults therefore nests the camera namespace (publishing under /camera/camera/... instead of the previous /camera/...), unlike the model-specific launch files in this change that push prefix here; this breaks existing subscribers and tools using the documented /camera/... topics.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| node_, "~/color/image_raw", rgb_qos); | ||
| depth_sub_ = std::make_shared<message_filters::Subscriber<sensor_msgs::msg::Image>>( | ||
| node_, "depth/image_raw", depth_qos); | ||
| node_, "~/depth/image_raw", depth_qos); |
There was a problem hiding this comment.
Keep D2C subscriptions on the image topics
When enable_d2c_viewer is true, these subscriptions now use private node-relative names (~), which expand below the node name, while setupPublishers() still publishes the camera images on the relative topics color/image_raw and depth/image_raw under the node namespace. As a result the synchronizer never receives the camera frames and the D2C viewer output stays silent unless separate private-topic publishers are added.
Useful? React with 👍 / 👎.
| depth_to_other_extrinsics_publishers_[COLOR] = | ||
| node_->create_publisher<orbbec_camera_msgs::msg::Extrinsics>( | ||
| "/" + camera_name_ + "/depth_to_color", extrinsics_qos); | ||
| "/" + prefix_ + camera_name_ + "/depth_to_color", extrinsics_qos); |
There was a problem hiding this comment.
Preserve namespace separators for extrinsics topics
With the new prefix launch argument used as a ROS namespace segment, a normal multi-robot launch such as prefix:=robot1 camera_name:=camera should publish under /robot1/camera/..., but this absolute topic concatenates the two strings into /robot1camera/depth_to_color. The same pattern is used for the other extrinsics publishers in this block, so prefixed deployments publish latched extrinsics outside the robot namespace and consumers looking under /robot1/camera miss them.
Useful? React with 👍 / 👎.
| if (enable_stream_[DEPTH] && enable_stream_[COLOR]) { | ||
| static const char *frame_id = "depth_to_color_extrinsics"; | ||
| std::string string_frame_id = prefix_ + camera_name_ + "_" + "depth_to_color_extrinsics"; | ||
| static const char *frame_id = string_frame_id.c_str(); |
There was a problem hiding this comment.
Do not cache frame ids from a local string
When more than one OBCameraNode is loaded in the same component process, this static pointer is initialized only once from the first call's stack-local string_frame_id; after that call returns the pointer dangles, and later cameras reuse stale or corrupted extrinsics frame IDs instead of their own prefix/camera_name. Store the frame id as a normal std::string (or a static string value if it truly must be static) before passing it to obExtrinsicsToMsg.
Useful? React with 👍 / 👎.
Hello,
I realized that when using multiple robots with multiple cameras it wasn't possible to set a prefix. So I modified the the launch files and main code to support a prefix (example: robot1, robot2), maintaining backward compatibility if no prefix is set.
I tested the modifications using 2 femto bolts:
Test with prefix:


Test without prefix:

